import {ADD_LIST} from "./actionsTypes";
import getDataService from '../services/getData';
import UserHelper from '../utils/userHelper';
import {Toast} from 'antd-mobile';

export const addList = data => ({type: ADD_LIST, data: data}); //年检信息
//获取办理流程列表
export const handlingList= (data, callBack) => {
	return (dispatch, getState) => {
		Toast.hide(); //加载前 先关闭其他加载中的提示框 避免提示框一直存在的bug
		Toast.loading("", 30, () => Toast.info("网络错误", 2));
		getDataService.flowDataList(data).then(resultData=>{
			Toast.hide();
			if (resultData.code == 1000) {
				if(callBack){
					callBack(resultData.data);
				}
			}
			else {
				Toast.info(resultData.msg, 2);
			}
		})
	}
};

